﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class FrontEnd_Control_BannerMenuStore
    Inherits System.Web.UI.UserControl
    Public URL As String = ""
    Dim level As String = 0
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load



        If Not Page.IsPostBack Then
            Dim _StoreId As Integer = Page.RouteData.Values("Id")
            Using _data As New VSEntities
                Dim p = (From q In _data.Stores Where q.StoreId = _StoreId Select q).FirstOrDefault
                If Not p Is Nothing AndAlso Not p.BigBanner Is Nothing AndAlso p.BigBanner <> "" Then
                    ImgLogo.ImageUrl = p.BigBanner
                    hplTopHeader.Visible = False
                    hplTopHeader.NavigateUrl = MainDomain & "salon-oto/" & p.QueryString & "-" & p.StoreId.ToString
                Else
                    hplTopHeaderLogo.Visible = False
                    ltrSalonName.Text = p.Title

                End If
                URL = "salon-oto/" & p.QueryString & "-" & p.StoreId.ToString
            End Using

            Dim lstNode As New DataSet
            lstNode.ReadXml(MapPath("../../xml/HeaderSalon.xml"))
            With rptMenu
                .DataSource = lstNode.Tables("Node")
                .DataBind()
            End With
            'bind category
            '  getMenu()

        End If


    End Sub
    Protected Sub rptMenu_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptMenu.ItemDataBound

        Dim ltrTitle As Literal
        ltrTitle = e.Item.FindControl("ltrTitle")
        If e.Item.DataItem("URL") = ".html" Then
            ltrTitle.Text = "<li><a href='" & MainDomain & URL & e.Item.DataItem("URL") & "'><span>" & e.Item.DataItem("Title") & "</span></a></li>"
        Else
            ltrTitle.Text = "<li><a href='" & MainDomain & URL & "/" & e.Item.DataItem("URL") & "'><span>" & e.Item.DataItem("Title") & "</span></a></li>"
        End If


     
    End Sub




End Class
